package Day2025_03_03;


public class HomeWork02 {
    public void Arrange(int[] arr, int start, int end) {
        if (start == end) {
            for (int i = 0; i <= start; i++) System.out.print(arr[i]);
            System.out.println();
        } else {
            for (int i = start; i <= end; i++) {
                swap(arr, start, i);
                Arrange(arr, start + 1, end);
                swap(arr, start, i);
            }
        }
    }
    public void swap(int[] arr, int i, int j) {
        int temp = arr[i];
        arr[i] = arr[j];
        arr[j] = temp;
    }

    public static void main(String[] args) {
        HomeWork02 hw = new HomeWork02();
        int[] arr = {1, 2, 3, 4, 5};
        hw.Arrange(arr, 0, arr.length - 1);
    }
}
